from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QListWidget


class ListWidget(QListWidget):
    '''subclass of QListWidget'''
    def __init__(self,parent):
        super(ListWidget, self).__init__(parent)

    def mousePressEvent(self, evt):
        '''rewrite,then only LeftButton clicked trigger event'''
        if evt.button() == Qt.LeftButton:
            super(ListWidget, self).mousePressEvent(evt)

    def mouseDoubleClickEvent(self, evt):
        '''rewrite,then only LeftButton clicked trigger event'''
        if evt.button() == Qt.LeftButton:
            super(ListWidget, self).mouseDoubleClickEvent(evt)
